package com.cskaoyan.config;

import com.cskaoyan.fandian.KFC;
import org.springframework.aop.framework.ProxyFactoryBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

/**
 * @author stone
 * @date 2022/09/30 16:26
 */
@Configuration
@ComponentScan("com.cskaoyan")
public class ChickenRestaurant {

    @Bean
    public ProxyFactoryBean kfcProxy(KFC target) {
        ProxyFactoryBean proxyFactoryBean = new ProxyFactoryBean();
        proxyFactoryBean.setTarget(target);//提供委托类组件
        proxyFactoryBean.setInterceptorNames("KFCAdvice");//提供通知组件id
        return proxyFactoryBean;
    }
}
